package com.hy.mvc.web.conroller;

import com.alibaba.fastjson.JSON;
import com.hy.mvc.biz.service.manager.UUserDOManager;
import com.hy.mvc.domain.dataobject.UUserDO;
import com.hy.mvc.domain.dataobject.entity.User;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.List;

/**
 * <pre>
 *    author  : Booker
 *    time    : 2017/12/4 17:22
 *    desc    : 输入描述
 *    version : v1.0
 * </pre>
 */
@Controller
@RequestMapping("/user")
@Api(tags = "用户相关")
public class UserController {

    private static final Logger logger = LoggerFactory.getLogger(UserController.class);
    private final String INDEX = "index";
    @Resource
    private UUserDOManager manager;

    @RequestMapping(value = "/findAll", method = RequestMethod.GET)
    @ApiOperation("查找所有用户")
    public @ResponseBody
    List<UUserDO> findAll(ModelMap modelMap) {
        List<UUserDO> list = manager.findAllValidUUserDO();
        modelMap.put("users", list);
        return list;
    }
}
